'''超时'''

def compute(a, l):
    # 注：切片得到的是拷贝，而不是引用，会时间效率低
    s1, e1 = [0, l]  # [0, l)
    s2, e2 = [l, len(a) - 1]  # [0, len-1)

    t1, t2 = a[0], a[l]
    for i in range(s1 + 1, e1):
        t1 ^= a[i]
    for i in range(s2 + 1, e2):
        t2 |= a[i]
    return t1 + t2 + a[-1]


def method(a: list):
    result = 0
    for l in range(1, len(a) -  1):  # [1, len-2], 小心边界问题
        rt = compute(a, l)
        if rt > result:
            result = rt
    return result

if __name__ == '__main__':
    _ = input()
    nums = [int(x) for x in input().split(' ')]
    print(method(nums))
